package com.twu.biblioteca;


import com.twu.biblioteca.Entity.Book;
import com.twu.biblioteca.Entity.Movie;
import com.twu.biblioteca.Model.BookList;
import com.twu.biblioteca.Model.MovieList;

import java.util.Iterator;
import java.util.Map;

public class MovieMenu extends Menu {
    private Map<String, Movie> menuOptions;
    private MovieList movieList;

    public MovieMenu(MovieList movieList) {
        this.movieList = movieList;
        setMenuOptions();
    }

    @Override
    public void setMenuOptions() {
        menuOptions = movieList.getMovieList();
    }

    @Override
    public void showMenu() {
        String menu = "";
        Iterator<Map.Entry<String, Movie>> entries = menuOptions.entrySet().iterator();
        while (entries.hasNext()) {
            Map.Entry<String, Movie> entry = (Map.Entry) entries.next();
            Movie movie = entry.getValue();
            if (!movie.isCheckOut()) {
                menu = menu + movie.getMovieId() + ". " + movie.getMovieName() + "\n";
            }
        }
        System.out.println(menu);
    }
}